import { IsNotEmpty, Length, IsString, IsNumber, IsOptional, Min, IsArray, ArrayMinSize, ArrayMaxSize } from 'class-validator';
import PaginationDto from '../../dtos/pagination.dto';

export default class Dto {
    @Min(0)
    @IsNumber({})
    @IsOptional()
    deviceId:number;

    @Min(0)
    @IsNumber({})
    @IsOptional()
    expireIn:number;

    @Min(0)
    @IsNumber({})
    @IsOptional()
    fee:string;
}

export class AddDto extends Dto {
    @Length(20, 20)
    @IsString()
    @IsNotEmpty()
    cardNo:string;
}

export class AddBatchDto extends Dto {
    @ArrayMaxSize(10000)
    @ArrayMinSize(1)
    @IsArray()
    data:Array<AddDto>
}


export class EditDto extends Dto {
    @Length(20, 20)
    @IsString()
    @IsOptional()
    cardNo:string;
}

export class PageDto extends PaginationDto {
    @Length(20, 20)
    @IsString()
    @IsOptional()
    cardNo:string;
}